Arch Linux Installation¶
Contents
Introduction¶
Arch Linux provides a well supported minimal Linux installation with a large software repository that allows a user to customise their system to their needs.
To install Arch Linux onto a SD card access to a Linux system is required.
Unless otherwise specified, all commands are performed as the root
user.
Create Partitions¶
Use the fdisk
command to set-up the SD card. Make sure that the correct device is being used. In this example the SD card is /dev/sda
.
We will be creating two patitions: a 100MB FAT32 partition for /boot
and a EXT4 partition for /
.
fdisk /dev/sda
Now enter the following commands
:
- Delete all partitions on the SD card:
o
- Create the FAT32 partition:
n
- Set the partition to be a primary one:
p
- Press
Enter
to use the default patition number (1) - Press
Enter
to use the default first sector - Set the size of the partition to 100MB:
+100M
- Set the type:
t
- Select FAT32 for the partition:
c
- Create the EXT4 partition:
n
- Set the partition to be a primary one:
p
- Press
Enter
to use the default patition number (2) - Press
Enter
to use the default first sector - Press
Enter
to use the default last sector (this will use all of the remaining space) - Save the changes to the SD card:
w
Verify partitons created:
fdisk -l /dev/sda
Disk /dev/sda: 31.9 GB, 31914983424 bytes, 62333952 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x117d9901
Device Boot Start End Blocks Id System
/dev/sda1 2048 206847 102400 c W95 FAT32 (LBA)
/dev/sda2 206848 62333951 31063552 83 Linux
Format and Mount Partitions¶
Format partitions:
mkfs.vfat /dev/sda1
mkfs.ext4 /dev/sda2
Make mount points:
mkdir boot root
Mount the SD card partitions:
mount /dev/sda1 boot
mount /dev/sda2 root
Install Arch Linux¶
Download the operating system:
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
Write to SD card:
bsdtar -xvpf ArchLinuxARM-rpi-2-latest.tar.gz -C root
Populate the /boot
partition:
mv root/boot/* boot/
Allow the root
user to login by editing root/etc/sshd_config
(e.g. using vi
) and set:
PermitRootLogin yes
Now unmount the SD card:
umount boot root
First Boot¶
Insert the SD card into your Raspberry Pi and turn it on. For network access connect the Raspberry Pi via an Ethernet cable to the nework.
Once booted login as the root
user using the password: alarm
.
Set-up pacman
so that packages can be installed and update the OS:
pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu
Set hostname to rpi
:
hostnamectl set-hostname rpi
Set the timezone:
timedatectl set-timezone Europe/London
Set the keyboard layout:
localectl set-keymap --no-convert uk
Set password for alarm user:
userdel -r alarm
Optionally add a user for us:
groupadd -g 1000 neil
useradd -u 1000 -g neil -m -G users neil
Set a static IP address for the Ethernet interface. A static IP is required as the Raspberry Pi will be the DHCP server for the network. In this case we are using 192.168.0.2
with a subnet mask of 255.255.255.0
. The gateway for the network is our router, which has the static IP address 192.168.0.1
. For now we will use CloudFlare’s DNS service but later we will change this to our own DNS service. See Dnsmasq.
Edit /etc/systemd/network/eth0.network
to make the following changes:
[Match]
Name=eth0
[Network]
Address=192.168.0.2/24
Gateway=192.168.0.1
DNS=1.1.1.1
DNSSEC=false
Note
DNSSEC
has been disabled as we do not have a Real Time Clock (RTC) to keep the time when the Raspberry Pi is powered off. If DNSSEC
is enabled then the systemd-timesyncd
will not able to update the time as DNS lookups of the Arch Linux NTP servers will fail due to DNSSEC validation errors. The time of the Raspberry server must be correct for DNSSEC
to operate. See the Real Time Clock guide for details about adding a RTC to the Raspberry Pi after which DNSSEC can be enabled.
Now reboot:
reboot